package com.ls.modules.designpattern.Prototype;

import com.google.common.collect.Maps;

import java.util.Map;
/**
 * @see 原型模式:实现复制粘贴功能-->复制一个文件到另外一个地方
 * @apiNote  核心思想:首先创建一个实例,然后通过这个实例去拷贝创建新的实例
 */
public class PrototypeTest {
    public static void main(String[] args) {
        Map<String, Double> stringDoubleMap = Maps.newHashMap();
        stringDoubleMap.put("奥巴马",234.45);
        stringDoubleMap.put("特朗普",564.45);
        stringDoubleMap.put("拜登",254.45);
        FileConcretePrototype AAAAA = new FileConcretePrototype(1,"中情局文件", stringDoubleMap);
        FileConcretePrototype BBBBB = (FileConcretePrototype)AAAAA.clone();
        FileConcretePrototype CCCCC = (FileConcretePrototype)AAAAA.clone();
        AAAAA.show();
        BBBBB.show();
        CCCCC.show();
        System.out.println(AAAAA == BBBBB);

    }
}
